package com.smile.spring.bean;

import java.io.IOException;

import com.smile.spring.service.MyBeanPostProcessor;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海申通快递总部
 * @company STO
 * @Date 2021/12/12 19:46
 */
public class Test01 {
    public static void main(String[] args) throws IOException {

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.scan("com.smile.spring.bean");
        context.register(MyBeanPostProcessor.class);
        context.refresh();
        System.out.println("Spring 上下文启动完成。。。。。");

        PersonBean personBean = (PersonBean)context.getBean("personBean");
        personBean.work();
        System.out.println("Spring 上下文准备关闭。。。。。");

        context.close();
        System.out.println("Spring 上下文已关闭。。。。。");

    }
}
